<template>
    <a-image :width='30' :src='src'></a-image>
</template>

<script lang='ts' setup>
    import QRCode from 'qrcode'
    import { ref } from 'vue'

    const props = defineProps<{
        data:string|number|object
    }>()

    const src = ref<string>()

    QRCode.toDataURL(typeof props.data == 'string' ? props.data : JSON.stringify(props.data)).then(res => {
        src.value = res
    })

</script>
